package com.register.hello.registerhello.controller;

import com.register.hello.registerhello.pojo.User;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

/**
 * @ClassName: HelloRegister
 * @Description: TODO
 * @Author WN
 * @Date 2021/7/15 15:35
 * @Version V1.0
 */
@RestController
public class HelloRegister {
    @RequestMapping("/hello")
    public String index() throws InterruptedException {
        return "Hello World8081";
    }
    @RequestMapping("/hello1")
    public String hello1(@RequestParam String name){
        return "hello"+name;
    }
    @RequestMapping("/hello2")
    public User hello2(@RequestHeader String name,@RequestHeader Integer age){
        return new User(name,age);
    }
    @RequestMapping("/hello3")
    public String hello3(@RequestBody User user){
        return user.toString();
    }

}
